package com.online.service;

import com.online.dao.StudentMapper;
import com.online.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    StudentMapper studentMapper;

    @Override
    public Student showAStudent(String studentNumber, String password) {
        return studentMapper.selectAStudent(studentNumber,password);
    }

    @Override
    public Student showByStudentNumber(String studentNumber) {
        return studentMapper.selectByStudentNumber(studentNumber);
    }

    @Override
    public Integer showStudentStatus(String studentNumber) {
        return studentMapper.selectStatusByStudentNumber(studentNumber);
    }

    @Override
    public int deleteByStudentClass(String className) {
        return studentMapper.deleteByStudentClass(className);
    }

    @Override
    public int addARecord(Student student) {
        return studentMapper.insertARecord(student);
    }

    @Override
    public List<Student> showByStudentClass(String studentClass) {
        return studentMapper.selectStudentByStudentClass(studentClass);
    }

    @Override
    public int deleteStudentById(Integer studentId) {
        return studentMapper.deleteStudentById(studentId);
    }

    @Override
    public Student showStudentById(Integer studentId) {
        return studentMapper.selectByStudentId(studentId);
    }

    @Override
    public int updateStatus(Integer studentId, Integer status) {
        return studentMapper.updateStudentStatus(studentId,status);
    }

    @Override
    public int updateStudentInfo(Integer id, String studentName, String password, String sex) {
        return studentMapper.updateStudentInfo(id,studentName,password,sex);
    }


}
